package models;

import java.util.*;

import javax.persistence.*;

import play.db.ebean.*;
import play.db.ebean.Model.Finder;
import play.data.format.*;
import play.data.validation.*;
import com.avaje.ebean.*;

@Entity
public class Theme extends Model {

	@Id
	private Long idTheme;
	private List<Matiere> sesMatieres;
	
	@Constraints.Required
	private String libelleT;

	public static Finder<Long, Theme> find = new Finder<Long, Theme>(
			Long.class, Theme.class);

	public static List<Theme> findAll() {
		return find.all();
	}

	public static Theme findById(Long id) {
		return Ebean.find(Theme.class, id);
	}

	public static void create(Theme theme) {
		theme.save();
	}

	public static void update(Theme theme) {
		theme.update();
	}

	/*
	 * GETTER ET SETTER
	 */
	@OneToMany(mappedBy = "theme")
	public List<Matiere> getSesMatieres() {
		return sesMatieres;
	}

	public void setSesMatieres(List<Matiere> t) {
		this.sesMatieres = t;
	}

	public Long getIdTheme() {
		return idTheme;
	}

	public void setIdTheme(Long idTheme) {
		this.idTheme = idTheme;
	}

	public String getLibelleT() {
		return libelleT;
	}

	public void setLibelleT(String libelleT) {
		this.libelleT = libelleT;
	}

}
